package com.apes.fn.business.fixedLoss.modle;

import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import com.apes.scm.masterdata.frame.model.Dept;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * @ClassName BusinessStrategyItem
 * @Author wsj
 * @Date 2021/5/7 14:50
 * @description 业务策略明细模型
 */
@Entity
@Table(name =BusinessStrategyItem.CONST_TABLE_NAME )
@SelectBeforeUpdate
@Getter
@Setter
@DynamicInsert
@DynamicUpdate
@EntityListeners(DefaultPersistListener.class)
public class BusinessStrategyItem extends BaseModel {
    public final static String CONST_TABLE_NAME = "Business_Strategy_item";

    @Id
    @Column(name = "id")
    @ApesGenerator(code = CONST_TABLE_NAME, name = "商务业务策略明细", padding = 5)
    @Comment("明细编码")
    private  String id;

    @ManyToOne(optional = false)
    @JoinColumn(name = "business_Strategy", referencedColumnName = "id")
    @Comment("商务业务策略单号")
    private BusinessStrategy businessStrategy;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "dept_id", referencedColumnName = "id")
    @Comment("门店")
    private Dept dept;


    @Column(name = "target_Amount", columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    @Comment("设定金额")
    private double targetAmount = 0;
}
